package com.prs.crm.action.fs.flow;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.ui.PaginationSupport;

import com.prs.crm.action.FlowAction;
import com.prs.crm.annotation.Clew;
import com.prs.crm.context.AppContext;
import com.prs.crm.domain.fs.OutlayApply;
import com.prs.crm.service.fs.OutlayApplyService;

public class OutlayApplyFlowAction extends FlowAction<OutlayApply>{
	private OutlayApplyService outlayApplyService;
	private OutlayApply outlayApply;
	private PaginationSupport pagination;
	
	@Action("listOutlayApplyFlow")
	public String listOutlayApplyFlow() {
		pagination = this.getPaginationHelper().prepare(pagination);
		this.setPagination(this.getOutlayApplyService().listFlowTask(OutlayApply.class, pagination, AppContext.getAccountContext().currentUser()));
		return SUCCESS;
	}
	
	@Action("editOutlayApplyFlow")
	public String editOutlayApplyFlow() {
		this.displayEndNodes();
		return SUCCESS;
	}
	
	@Clew(results={"success"})
	@Action(value="submitOutlayApplyFlow",results={@Result(name="success",type="redirect",location="listOutlayApplyFlow")})
	public String submitOutlayApplyFlow() {
		this.getOutlayApplyService().execute(this.getNode(), this.getDetail(), outlayApply, AppContext.getAccountContext().currentUser());
		this.setPrompt("提交成功");
		return SUCCESS;
	}
	
	public OutlayApplyService getOutlayApplyService() {
		return outlayApplyService;
	}
	public void setOutlayApplyService(OutlayApplyService outlayApplyService) {
		this.outlayApplyService = outlayApplyService;
	}
	public OutlayApply getOutlayApply() {
		return outlayApply;
	}
	public void setOutlayApply(OutlayApply outlayApply) {
		this.outlayApply = outlayApply;
	}
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	
}
